package org.gd.hellojavacore.patterns.adapter;

public class ClassAdapter implements Adapter {

    public static void main(String[] args) {
        Chief ch = new ChiefAdapter();
        Object dish = ch.makeBreakfast();
        Client.eat(dish);
        dish = ch.makeLunch();
        Client.eat(dish);
        dish = ch.makeDinner();
        Client.eat(dish);
        //callAmbulance();
    }

    private static interface Chief {
        public Object makeBreakfast();
        public Object makeLunch();
        public Object makeDinner();
    }
    // Adaptee
    private static class Plumber {
        public Object getScrewNut() {
            // ...
            return null;
        }

        public Object getPipe() {
            // ...
            return null;
        }

        public Object getGasket() {
            // ...
            return null;
        }
    }
    // Adapter
    private static class ChiefAdapter extends Plumber implements Chief {
        public Object makeBreakfast() {
            return getGasket();
        }

        public Object makeLunch() {
            return getPipe();
        }

        public Object makeDinner() {
            return getScrewNut();
        }
    }
    // Client
    private static class Client {
        public static void eat(Object dish) {
            // ...
        }
    }
}

